<?

include '../util/globals.php';

function page_begin($use_header = true, $use_left = true, $left_content="default") {
    echo "<html lang=\"pt_BR\">\n\n";
    echo "<header>";
    echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n\n";
    echo "<link rel=\"stylesheet\" href=\"../resources/content_style.css\" type=\"text/css\">\n\n";
    echo "<title>$WEBAPP_TITLE</title>\n\n";
    echo "</header>\n\n";
    echo "<body>\n\n";

    # root div
    echo "<div class=\"main_content\">\n\n";

    if ($use_header) {
        # cabeçalho
        echo "<div class=\"header_content\">\n\n";
        echo "Header";
        echo "</div>\n\n";
    }

    # menu da esquerda
    if ($use_left) {
        echo "<div class=\"left_content\">\n\n";
        if($left_content == 'default') {

        }
        else {
            echo $left_content;
        }
        echo "\n\n</div>\n\n";
    }

    # conteúdo
    if ($use_left) {
        echo "<div class=\"center_content\" id=\"partial\">\n\n";
    } else {
        echo "<div class=\"center_content\" id=\"full\">\n\n";
    }
}

function page_end($bottom_bar = true) {
    echo "\n\n</div>\n\n";
    echo "\n\n</div>\n\n";
    echo "</body>\n\n";
    echo "</html>";
}

function default_page_begin() {
    page_begin();
    # TODO: construir menus, divs, etc
}

function default_page_end() {
    page_end();
}

function write_default_page($content) {
    default_page_begin();
    echo "$content";
    default_page_end();
}

?>
